package com.da.javatest.leetCode;

import java.util.Arrays;

/**
 * @author chenlida
 * @date 2018/12/20 15:04
 * @description
 */
public class Code561 {
    public int arrayPairSum(int[] nums) {
        Arrays.sort(nums);
        int total = 0;
        for (int i = 1; i < nums.length; i += 2) {
            total += Math.min(nums[i], nums[i - 1]);
        }
        return total;
    }
}
